#ifndef UTIL_H_
#define UTIL_H_

#include <string>
#include <vector>
#include <iostream>
#include <fstream>
#include <algorithm>
#include "mongo/client/dbclient.h"

#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
string get_dir (string const& str);
int explode(std::string str, std::string delimiter, std::vector<std::string> &store);
template<typename T>
void print(vector<T> &arr);
int loadIntVector(const char* filename, vector<int>& vec);
int loadIntVectorArray(const char* filename, vector< vector<int> > &vecArray,
        int maxSetNum=-1);
bool isSampledQuestionId(int qId);
void getBoolSearchRet(const std::vector<int> &terms, std::vector<int> &ret,
        const std::string mongodbCollection="ask.ageId_488",
        const std::string host="localhost"); 
void getBoolSearchRet(std::map<int,float> &terms, std::vector<int> &ret, 
        const std::string mongodbCollection, const std::string host);
typedef std::pair<int,float> termpair;
bool comparator_term( const termpair& l, const termpair& r);
#endif //UTIL_H
